/**
 * 
 */
package persistence;

import java.util.ResourceBundle;

import persistence.Factories.DAOFactory;
import persistence.Factories.DAOSQLFactory;
import persistence.Factories.DAOXMLFactory;

/**
 * @author hozakan
 *
 */
public class Strategie {

	private static Strategie instance;
	
	private DAOFactory factory;
	
	public static Strategie getInstance() {
		if (instance == null)
			instance = new Strategie();
		return instance;
	}
	
	private Strategie() {
		ResourceBundle res = ResourceBundle.getBundle("resources/configPersis");
		String persisType = res.getString("persisType");
		if (persisType.equals("SQL")) {
			factory = new DAOSQLFactory(); 
		} else if (persisType.equals("XML")) {
			factory = new DAOXMLFactory();
		}
	}
	
	public DAOFactory getDAOFactory() {
		return factory;
	}
	
}
